home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / vb / inpgrid.exe / CCINIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-17  |  2.3 KB  |  93 lines

  1. //---------------------------------------------------------------------------
  2. // ccInit.c
  3. //---------------------------------------------------------------------------
  4. // Custom Control DLL Initialization
  5. //---------------------------------------------------------------------------
  6.  
  7. #define NOCOMM
  8.  
  9. #include <windows.h>
  10.  
  11. #define CTL_DATA    // cause the control structures to be declared
  12.  
  13. #include "vbapi.h"
  14. #include "griglia.h"
  15.  
  16. HANDLE    hmodDLL;
  17.  
  18. //---------------------------------------------------------------------------
  19. // Register custom control.
  20. //    This routine is called by VB when the custom control DLL is
  21. //    loaded for use.
  22. //---------------------------------------------------------------------------
  23.  
  24. BOOL FAR PASCAL _export VBINITCC
  25. (
  26.     USHORT usVersion,
  27.     BOOL fRuntime
  28. )
  29. {
  30.     // avoid warnings on unused (but required) formal parameters
  31.  
  32.     fRuntime = fRuntime;
  33.     usVersion = usVersion;
  34.  
  35.     // Register control(s)
  36.  
  37.     if (!VBRegisterModel(hmodDLL, &modelList))
  38.     return FALSE;
  39.  
  40.     return TRUE;
  41. }
  42.  
  43. //---------------------------------------------------------------------------
  44. //  Initialize library.
  45. //    This routine is called from the DLL entry point in LIBINIT.ASM
  46. //    which is called when the first client loads the DLL.
  47. //---------------------------------------------------------------------------
  48.  
  49. BOOL FAR LibMain
  50. (
  51.     HANDLE    hmod,
  52.     HANDLE    segDS,
  53.     USHORT    cbHeapSize
  54. )
  55. {
  56.     // avoid warnings on unused (but required) formal parameters
  57.  
  58.     cbHeapSize = cbHeapSize;
  59.     segDS = segDS;
  60.  
  61.     hmodDLL = hmod;
  62.  
  63.     // Allocate Heap
  64.     if (cbHeapSize != 0)
  65.         LocalInit (segDS, NULL, cbHeapSize);
  66.  
  67.     // Leave our DS unlocked when we're not running
  68.     UnlockData( 0 );
  69.  
  70.     GrigliaLibLoad ();
  71.  
  72.     return TRUE;
  73. }
  74.  
  75. //---------------------------------------------------------------------------
  76. //  Handle exit notification from Windows
  77. //    This routine is called by Windows when the library is freed
  78. //    by its last client.
  79. //---------------------------------------------------------------------------
  80.  
  81. VOID FAR _export WEP
  82. (
  83.     BOOL    fSystemExit
  84. )
  85. {
  86.     GrigliaLibUnload ();
  87.     // avoid warnings on unused (but required) formal parameters
  88.  
  89.     fSystemExit = fSystemExit;
  90. }
  91.  
  92. //---------------------------------------------------------------------------
  93.